package com.yiqi.lottery.feature.mine.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.UserInfoBo;
import com.yiqi.lottery.entity.bo.RegisterBo;
import com.yiqi.lottery.feature.mine.contract.BindContract;
import com.yiqi.lottery.feature.mine.contract.MineContract;
import com.yiqi.lottery.feature.mine.dependencies.bind.DaggerBindModelComponent;
import com.yiqi.lottery.framework.api.ApiLib;
import com.yiqi.lottery.framework.api.UserApi;
import io.reactivex.Observable;

import javax.inject.Inject;

public class BindModel implements BindContract.Model {

    @Inject
    UserApi api;


    @Inject
    public BindModel() {

        DaggerBindModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<String> getOldPhoneVerify(RegisterBo registerBo) {
        return api.userVerifyMobile(registerBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> userBindSendCode(String mobile) {
        return api.userRegisterSendCode(mobile).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> getNewPhoneVerify(RegisterBo registerBo) {
        return api.userBindMobile(registerBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
